package com.aspose.cells;

import java.util.Iterator;

class zais {
   private zoz a = null;
   private Workbook b = null;
   private String c = null;
   private zcfk d = null;

   zais(zoz var1, String var2) {
      this.a = var1;
      this.b = var1.a;
      this.c = var2;
   }

   void a(zcfk var1) throws Exception {
      this.d = var1;
      this.a();
   }

   private void a() throws Exception {
      zcfl var1 = this.d.d_();
      if (var1 != null) {
         ExternalConnectionCollection var2 = this.b.getDataConnections();
         var2.b = var1.b("xmlns");
         zcfl var3 = null;
         Iterator var4 = var1.j().iterator();

         while(true) {
            Object var5;
            do {
               if (!var4.hasNext()) {
                  return;
               }

               var5 = var4.next();
            } while(!(var5 instanceof zcfl));

            var3 = (zcfl)var5;
            Object var6 = null;
            zcfs var7 = var3.j();
            zcfl var8 = null;
            Iterator var9 = var7.iterator();

            while(var9.hasNext()) {
               Object var10 = var9.next();
               if (var10 instanceof zcfl) {
                  var8 = (zcfl)var10;
                  if ("dbPr".equals(var8.g)) {
                     if (!this.a(var7)) {
                        var6 = new DBConnection();
                     } else {
                        var6 = new zaro();
                     }

                     this.a((DBConnection)var6, var8);
                  } else if ("olapPr".equals(var8.g)) {
                     if (var6 == null) {
                        var6 = new zaro();
                     }

                     this.a((zaro)var6, var8);
                  } else if ("textPr".equals(var8.g)) {
                     var6 = new zbsr();
                     this.a((zbsr)var6, var8);
                  } else if ("webPr".equals(var8.g)) {
                     var6 = new zbve();
                     this.a((zbve)var6, var8);
                  } else if ("parameters".equals(var8.g)) {
                     this.a(((ExternalConnection)var6).getParameters(), var8);
                  } else if ("extLst".equals(var8.g) && var6 != null) {
                     ((ExternalConnection)var6).f = var8.c();
                  }
               }
            }

            if (var6 != null) {
               this.a((ExternalConnection)var6, var3);
               ((ExternalConnection)var6).A = var3.c();
               ((ExternalConnection)var6).B = var2;
               var2.a((ExternalConnection)var6);
            } else {
               zbud var11 = new zbud();
               this.a((ExternalConnection)var11, var3);
               var11.A = var3.c();
               var11.B = var2;
               var2.a((ExternalConnection)var11);
            }
         }
      }
   }

   private void a(DBConnection var1, zcfl var2) {
      String var3 = var2.b("commandType");
      if (var3 != null) {
         var1.c = zuo.h(zase.C(var3));
      }

      var1.a = var2.b("command");
      var1.d = var2.b("connection");
      var1.b = var2.b("serverCommand");
   }

   private void a(zaro var1, zcfl var2) {
   }

   private void a(zbsr var1, zcfl var2) {
   }

   private void a(zbve var1, zcfl var2) {
   }

   private void a(ConnectionParameterCollection var1, zcfl var2) {
      if (var2 != null) {
         zcfl var3 = null;
         String var4 = null;
         ConnectionParameter var5 = null;
         Iterator var6 = var2.j().iterator();

         while(var6.hasNext()) {
            Object var7 = var6.next();
            if (var7 instanceof zcfl) {
               var3 = (zcfl)var7;
               var5 = new ConnectionParameter();
               var1.a(var5);
               var4 = var3.b("boolean");
               if (var4 != null && "1".equals(var4)) {
                  if ("1".equals(var4)) {
                     var5.a = true;
                  } else {
                     var5.a = false;
                  }
               }

               var5.b = var3.b("cell");
               var4 = var3.b("double");
               if (null != var4) {
                  var5.a = zase.B(var4);
               }

               var4 = var3.b("integer");
               if (null != var4) {
                  var5.a = zase.C(var4);
               }

               var5.c = var3.b("name");
               var4 = var3.b("parameterType");
               if (var4 != null) {
                  var5.d = zuo.b(var4);
               }

               var5.e = var3.b("prompt");
               var4 = var3.b("refreshOnChange");
               if (var4 != null && "1".equals(var4)) {
                  var5.f = true;
               }

               var4 = var3.b("sqlType");
               if (var4 != null) {
                  var5.g = zuo.f(zase.C(var4));
               }

               var4 = var3.b("string");
               if (var4 != null) {
                  var5.a = var4;
               }
            }
         }

      }
   }

   private void a(ExternalConnection var1, zcfl var2) {
      String var3 = var2.b("background");
      if (var3 != null && "1".equals(var3)) {
         var1.g = true;
      }

      var3 = var2.b("credentials");
      if (var3 != null) {
         var1.h = zuo.a(var3);
      }

      var3 = var2.b("deleted");
      if (var3 != null && "1".equals(var3)) {
         var1.i = true;
      }

      var1.j = var2.b("description");
      var3 = var2.b("id");
      if (var3 != null) {
         var1.k = zase.C(var3);
      }

      var3 = var2.b("interval");
      if (var3 != null) {
         var1.l = zase.C(var3);
      }

      var3 = var2.b("keepAlive");
      if (var3 != null && "1".equals(var3)) {
         var1.m = true;
      }

      var3 = var2.b("minRefreshableVersion");
      if (var3 != null) {
         var1.n = (byte)zase.C(var3);
      }

      var1.o = var2.b("name");
      var3 = var2.b("new");
      if (var3 != null && "1".equals(var3)) {
         var1.p = true;
      }

      var1.q = var2.b("odcFile");
      var3 = var2.b("onlyUseConnectionFile");
      if (var3 != null && "1".equals(var3)) {
         var1.r = true;
      }

      var3 = var2.b("reconnectionMethod");
      if (null != var3) {
         var1.s = zuo.b(zase.C(var3));
      }

      var3 = var2.b("refreshedVersion");
      if (null != var3) {
         var1.t = (byte)zase.C(var3);
      }

      var3 = var2.b("refreshOnLoad");
      if (null != var3 && "1".equals(var3)) {
         var1.u = true;
      }

      var3 = var2.b("saveData");
      if (null != var3 && "1".equals(var3)) {
         var1.v = true;
      }

      var3 = var2.b("savePassword");
      if (null != var3 && "1".equals(var3)) {
         var1.w = true;
      }

      var1.x = var2.b("singleSignOnId");
      var1.y = var2.b("sourceFile");
      var3 = var2.b("type");
      if (null != var3) {
         var1.z = zuo.d(zase.C(var3));
      }

   }

   private boolean a(zcfs var1) {
      if (var1.a() < 2) {
         return false;
      } else {
         zcfl var2 = null;
         boolean var3 = false;
         boolean var4 = false;
         Iterator var5 = var1.iterator();

         while(var5.hasNext()) {
            Object var6 = var5.next();
            if (var6 instanceof zcfl) {
               var2 = (zcfl)var6;
               if ("olapPr".equals(var2.g)) {
                  var3 = true;
               }

               if ("dbPr".equals(var2.g)) {
                  var4 = true;
               }
            }
         }

         return var3 && var4;
      }
   }
}
